package com.fatmeraid.domain;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@Schema(description = "订单实体类")
@TableName("order_detail")
public class Order {
	@Schema(description = "订单id")
	@TableId(type = IdType.ASSIGN_ID, value = "order_id")
	private Long orderId;

	@Schema(description = "购买用户id")
	private Long userId;

	@Schema(description = "农户ID")
	private Long farmerId;

	@Schema(description = "产品ID")
	private Long productId;

	@Schema(description = "商品名称")
	@TableField(exist = false)
	private String productName;

	@Schema(description = "购买数量")
	private Integer quantity;

	@Schema(description = "购买时单价")
	@TableField(value = "unit_price")
	private Double unitPrice;

	@Schema(description = "总价")
	@TableField(value = "total_price")
	private Double totalPrice;

	@Schema(description = "订单状态：0-待付款，1-待发货，2-已发货，3-已收货，4-已取消")
	@TableField(value = "order_status")
	private Integer status;

	@Schema(description = "交易编号")
	@TableField(value = "transaction_id")
	private String transactionId;


	@Schema(description = "支付时间")
	@TableField(value = "payment_time")
	private LocalDateTime paymentTime;

	@Schema(description = "发货时间")
	@TableField(value = "delivery_time")
	private LocalDateTime deliveryTime;

	@Schema(description = "收货时间")
	@TableField(value = "receive_time")
	private LocalDateTime receiptTime;

	@Schema(description = "收货地址")
	@TableField(value = "shipping_address")
	private String shippingAddress;

	@Schema(description = "收货人姓名")
	@TableField(value = "recipient_name")
	private String receiptName;

	@Schema(description = "收货人电话")
	@TableField(value = "recipient_phone")
	private String receiptPhone;


	@Schema(description = "创建时间")
	@TableField(value = "create_time")
	private LocalDateTime createTime;

	// 逻辑删除
	@Schema(description = "删除标志：0-正常，1-删除")
	@TableLogic(value = "0", delval = "1")
	@TableField("`delete`")
	private Integer delete;


}
